home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7928 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.3 KB  |  50 lines

  1. Path: news.rain.org!usenet
  2. From: "Guus Leeuw jr." <guusl@eiffel.com>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: My last chance....Format Routine
  5. Date: Thu, 29 Feb 1996 10:44:29 -0800
  6. Organization: Interactive Software Engineering Inc. http://www.eiffel.com/
  7. Message-ID: <3135F40D.665F4782@eiffel.com>
  8. References: <1996Feb29.091821.1500@es.dupont.com>
  9. NNTP-Posting-Host: @outback.eiffel.com
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (X11; I; Linux 1.2.8 i586)
  14.  
  15. Malcolm Smart wrote:
  16. > I've posted this to the COMP.OS.DOS etc groups with no joy.
  17. > Does anyone know of a c routine to format a floppy disk?  My client
  18. > wishes to remove program manager from the windows setup, but still wishes
  19. > to allow users to format floppies.
  20.  
  21. You might have a look at the `system()' function from `stdlib.h'.
  22.  
  23. In your case you will call it like:
  24.  
  25. #include <stdlib.h>
  26.  
  27. int main()
  28. {
  29.     if((system("format a:")) == -1)
  30.     {
  31.         /* Check the error */
  32.  
  33.         return 0;
  34.     }
  35.  
  36.     return 1;
  37. }
  38.  
  39. Regards,
  40.     Guus
  41.  
  42. PS: Commandment 7 says: "Thou shalt study thy libraries and strive not to reinvent
  43. them without cause, that thy code may be short and readable and thy days pleasant and
  44. productive."
  45.  
  46. PPS: And of course, FAQ 19.27 has some explanation on system()
  47.